package com.newdjk.newdoctor.adapter;

import android.text.TextUtils;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.newdjk.newdoctor.MyApplication;
import com.newdjk.newdoctor.R;
import com.newdjk.newdoctor.utils.GlideUtils;
import com.newdjk.okhttp.entity.OrderListEntity;
import com.newdjk.okhttp.entity.SystemListEntity;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public class SystemListAdapter extends BaseQuickAdapter<SystemListEntity.ReturnDataBean, BaseViewHolder> {

    List<SystemListEntity.ReturnDataBean> mPaintList;

    public SystemListAdapter(@Nullable List<SystemListEntity.ReturnDataBean> data) {
        super(R.layout.system_item_list, data);
        mPaintList = data;
    }

    @Override
    protected void convert(@NotNull BaseViewHolder helper, SystemListEntity.ReturnDataBean returnDataBean) {

        //501下单成功通知   502发货通知  503 取消通知  504订单退款通知   505订单退款失败通知   506订单完成
        //消息类型(1-开方后信息，2-审核后信息，3-核对后信息，4-作废后信息)
        TextView ordertext = helper.findView(R.id.order_type_desc);
        int type = returnDataBean.getMessageType();
        int roletype=MyApplication.LoginEntity.getUser().getRoleType();
        switch (type) {
            case 1:

                ordertext.setText("您有一条处方待审核");
                // ordertext.setTextColor(getContext().getResources().getColor(R.color.ordernotfinish));

                break;
            case 2:
                ordertext.setText("您有一条处方待处理");

                break;
            case 3:
                ordertext.setText("您有一条处方已完成");

                break;
            case 4:
                ordertext.setText("您有一条处方被作废");

                break;
            case 5:
                ordertext.setText("处方已开出待平台药师审核");
                break;
            case 6:
                ordertext.setText("处方已开出请通知药店药师审核");
                break;
            case 7:
                ordertext.setText("处方已审核等待调配");
                break;
            case 8:
                ordertext.setText("处方已调配等待核对");
                break;
        }

        helper.setText(R.id.tv_name, TextUtils.isEmpty(returnDataBean.getPatientName()) ? "" : returnDataBean.getPatientName());
        helper.setText(R.id.tv_age, TextUtils.isEmpty(returnDataBean.getPatientAge()) ? "" : returnDataBean.getPatientAge());
        helper.setText(R.id.tv_message_content, "诊断:"+(TextUtils.isEmpty(returnDataBean.getMessageContent()) ? "" : returnDataBean.getMessageContent()));

        int sex = returnDataBean.getPatientSex();
        switch (sex) {//（ 1男 2女 3未知）
            case 1:
                helper.setText(R.id.tv_sex, "男");

                break;
            case 2:
                helper.setText(R.id.tv_sex, "女");
                break;
            case 3:
                helper.setText(R.id.tv_sex, "未知");
                break;
        }
        int isread = returnDataBean.getIsRead();
        if (isread == 0) {
            helper.setVisible(R.id.order_unread_num, true);
        } else {
            helper.setVisible(R.id.order_unread_num, false);

        }

    }


}